<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>对使用 MIME base64 编码的数据进行解码</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.base64-decode" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">base64_decode</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">base64_decode</span> &mdash; <span class="dc-title">对使用 MIME base64 编码的数据进行解码</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.base64-decode-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>base64_decode</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$strict</code><span class="initializer"> = false</span></span>
  ] ) : <span class="type">string</span></div>

  <p class="para rdfs-comment">
   对 base64 编码的 <code class="parameter">data</code> 进行解码。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.base64-decode-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">data</code></dt>

     <dd>

      <p class="para">
       编码过的数据。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">strict</code></dt>

     <dd>

      <p class="para">
       当设置 <code class="parameter">strict</code> 为 <strong><code>TRUE</code></strong> 时，一旦输入的数据超出了 base64 字母表，将返回 <strong><code>FALSE</code></strong>。
       否则会静默丢弃无效的字符。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.base64-decode-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回原始数据， 或者在失败时返回 <strong><code>FALSE</code></strong>。返回的数据可能是二进制的。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.base64-decode-changelog">
  <h3 class="title">更新日志</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>版本</th>
       <th>说明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.2.0</td>
       <td>增加了 <code class="parameter">strict</code> 。</td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.base64-decode-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4881">
    <p><strong>Example #1 <span class="function"><strong>base64_decode()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw=='</span><span style="color: #007700">;<br />echo&nbsp;</span><span style="color: #0000BB">base64_decode</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
This is an encoded string
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.base64-decode-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="base64_encode.html" class="function" rel="rdfs-seeAlso">base64_encode()</a> - 使用 MIME base64 对数据进行编码</span></li>
    <li class="member">
     <a href="http://www.faqs.org/rfcs/rfc2045" class="link external">&raquo;&nbsp;RFC 2045</a> 的 6.8 章节。
     </li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>